using System.Collections.Generic;
using Framework.Core.Io;

namespace Framework.Core.Process
{
    public sealed class RemoteProcessController : IProcessController
    {
        private readonly IProcessController processController;

        internal RemoteProcessController(IProcessController processController)
        {
            this.processController = processController;
        }

        public RemoteProcessController(string remoteMachine, string remoteUser = "", string remotePassword = "")
            : this(new ProcessController(new RemoteProcessRunner(remoteMachine, remoteUser, remotePassword)))
        {

        }

        public IEnumerable<IProcess> KillLocker(string path)
        {
            return processController.KillLocker(path);
        }

        public void Kill(IProcess process)
        {
            processController.Kill(process);
        }

        public void Install(IWindowsServiceArgs windowsServiceArgs)
        {
            processController.Install(windowsServiceArgs);
        }

        public void Uninstall(IWindowsServiceArgs windowsServiceArgs)
        {
            processController.Uninstall(windowsServiceArgs);
        }

        public IEnumerable<WindowsService> GetServices()
        {
            return processController.GetServices();
        }

        public IEnumerable<IProcess> GetProcesses()
        {
            return processController.GetProcesses();
        }

        public ProcessResult Start(ICommand command, int timeout = -1)
        {
            return processController.Start(command, timeout);
        }
    }
}